# 3.2.1 Numbers

import math
x = 5 + 2 - 3*2

print(x)

print(5 / 2)

print(5 // 2)

print(5 % 2)

print(2 ** 8)

print(1000000001 ** 3)

print(4.3 ** 2.4)

print(3.5e30*2.77e45)

print(1000000001.0 ** 3)

# 复数

print((3+2j) ** (2+3j))

x = (3+2j) * (4 + 9j)

print(x)
print(x.real)
print(x.imag)

print("数值 四舍五入")
print(round(3.49))
print(round(3.49, 1))

print("向上取整")
print(math.ceil(3.49))


# 内置列表
x = ['first', 'second', 'third', 'fourth']
print(x[0])   # 0 表示第一个元素
print(x[2])
print(x[-1])  # 索引为 -1 时，表示最后一个
print(x[1:-1])   # 表标第2个元素到最后一个元素

#元组
()
(1,)
(1,2,3,4,5,6,7,8,12)
(1,'two',3 ,4.0,["a","b"],(5,6))

# list 转 tuple
x = [1,2,3,4]
tuple(x)

#dictionaries 字典

x = {1:"one",2:"two"}
x["first"] = "one"
x[("Delorme","Ryan",1995)] = (1,2,3)
print(x)
print(list(x.keys()))

#集合 sets

x = set([1,2,3,5])
print(x)
print(4 in x)
